package fivecardstudd;

public class Card  {
     
       
        public enum CardRankEnum  {
              
            DEUCE(2), THREE(3), FOUR(4),  FIVE(5), SIX(6),  SEVEN(7), EIGHT(8), NINE(9),TEN(10), 
		     JACK(11),  QUEEN(12), KING(13), ACE(14);
        
                private int rankValue;
                
                CardRankEnum(int rankValue) {
                        this.rankValue = rankValue;
                }
                
                public int getValue(){
                        return rankValue;
                }
        }
        
     
       
        public enum CardSuitEnum  {
                DIAMONDS(3),  CLUBS(2),  HEARTS(4),  SPADES(1);
                
                 private int suitValue;
      
                  CardSuitEnum(int suitValue) {
                  this.suitValue = suitValue;
                     }
                
                 
                  public int getValue() {
                      return suitValue;
                   }
              }
         
       
        private CardRankEnum rank;
      
        private CardSuitEnum suit;
        
        private boolean faceUp;
      
        private int intRepresentation;
 
        public Card(CardRankEnum rank, CardSuitEnum suit) {
                this.rank = rank;
                this.suit = suit;
                this.faceUp = true;
                intRepresentation = 10*rank.getValue() + suit.getValue();
        }

    
        
        public int asInt() {
                return intRepresentation;
        }
        
      
        public void setFaceUp(boolean faceUp) {
                this.faceUp = faceUp;
        }
        
       
        public boolean isFaceUp() {
                return faceUp;
        }

      
        public CardRankEnum getRank() {
                return rank;
        }
        
        public int getCardValue(){
                return rank.getValue();
        }
        
     
        public CardSuitEnum getSuit() {
                return suit;
        }

        @Override
        public String toString() {
                return "Card [rank="+rank+", suit="+suit+", faceUp="+faceUp+"]";
        }
}
